package com.qiaofang.collectmanagebff.service.impl;

import com.qiaofang.collectmanage.stub.bean.*;
import com.qiaofang.collectmanage.stub.feign.client.CollectRuleClient;
import com.qiaofang.collectmanagebff.base.vo.CollectRuleVO;
import com.qiaofang.collectmanagebff.service.CollectRuleService;
import com.qiaofang.collectmanagebff.service.util.CollectRuleConvert;
import com.qiaofang.common.model.page.PageDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("collectRuleService")
public class CollectRuleServiceImpl implements CollectRuleService {
	private static final Logger LOGGER = LoggerFactory.getLogger(CollectRuleServiceImpl.class);

	@Autowired
	private CollectRuleClient collectRuleClient;

	@Override
	public CollectRuleVO getCollectRuleById(Integer  id) {
		return CollectRuleConvert.convertDTO2VO(collectRuleClient.getCollectRuleById(id));
	}


	@Override
	public CollectRuleVO getCollectRule(GetCollectRuleDTO getCollectRuleDTO) {
		return CollectRuleConvert.convertDTO2VO(collectRuleClient.getCollectRule(getCollectRuleDTO));
	}

	@Override
	public void saveCollectRule(SaveCollectRuleDTO saveCollectRuleDTO) {
		 collectRuleClient.saveCollectRule(saveCollectRuleDTO);
	}

	@Override
	public void updateCollectRule(UpdateCollectRuleDTO updateCollectRuleDTO) {
		collectRuleClient.updateCollectRule(updateCollectRuleDTO);
	}

	@Override
	public void removeCollectRule(RemoveCollectRuleDTO removeCollectRuleDTO) {
		collectRuleClient.removeCollectRule(removeCollectRuleDTO);
	}

	@Override
	public SearchCollectRulePageDTO searchCollectRulePage(PageDTO pageDTO, SearchCollectRulePostDTO searchCollectRulePostDTO) {
		return collectRuleClient.searchCollectRulePage(pageDTO,searchCollectRulePostDTO);
	}

	@Override
	public void commonCityExtend(String city, String source, String belonger, String collectType, String collectHouseType, List<CommonCityExtendDTO> data) {
		collectRuleClient.commonCityExtend(data,city,collectType,collectHouseType, belonger, source);
	}

	@Override
	public List<String> getCitys() {
		return collectRuleClient.getCitys();
	}

	@Override
	public List<String> getSources() {
		return collectRuleClient.getSources();
	}
}
